<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title data-i18n="resources.title_mapService"></title>
    <script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? window.server : "https://iserver.supermap.io";
    var map, infoWin, url = host + "/iserver/services/map-world/rest/maps/World";
    map = L.map('map', {
        preferCanvas: true,
        crs: L.CRS.EPSG4326,
        center: {lon: 0, lat: 0},
        maxZoom: 18,
        zoom: 2
    });
    new L.supermap.TiledMapLayer(url).addTo(map);
    mapService();

    function mapService() {
        new L.supermap.MapService(url).getMapInfo().then((serviceResult) => {
            var result = serviceResult.result;
            var innerHTML = "("+resources.text_mapInfoPrint+")" + "<br><br>";
            innerHTML += resources.text_mapName+"：" + JSON.stringify(result.name, null, 2) + "<br>";
            innerHTML +=  resources.text_center+":" + JSON.stringify(result.center, null, 2) + "<br>";
            innerHTML += "Bounds:" + JSON.stringify(result.bounds, null, 2) + "<br>";
            infoWin = L.popup({maxWidth: 400, closeOnClick:false})
                .setLatLng(map.getCenter())
                .setContent(innerHTML)
                .openOn(map);
        });
    }
</script>
</body>
</html>